javascript email validation.

<html>
<script>  
function emailvalidation()  
{  
var x=document.myform.email.value;  
var aposition=x.indexOf("@");  
var dposition=x.lastIndexOf(".");  
if (aposition<1 || dposition<atposition+2 || dposition+2>=x.length){  
  alert("Please enter a valid e-mail address \n apostion:"+aposition+"\n dposition:"+dposition);  
  return false;  
  }  
}  
</script>  
<body>  
<form name="myform"  method="post" action="C:\Users\tejas\OneDrive\Desktop\newprogram\email_valild.html" onsubmit="return emailvalidation()">  
Email: <input type="text" name="email"><br/>  
  
<input type="submit" value="register">  
</form>  
</body>
</html>
output
javascript email validation.


Post a Comment

0 Comments